import { observer } from "mobx-react";
import Dialog from ".";
import { WeaTableEdit,WeaTableEditable,WeaLocaleProvider } from 'ecCom';
import {toJS} from 'mobx';
const getLabel = WeaLocaleProvider.getLabel;
@observer
export default class OperateMenuDialog extends React.Component {



    render() {
        const { store } = this.props;
        const { readonly } = store;
        const columns = [
            {
                title: getLabel('502503','按钮名称'),
                dataIndex: "btnName",
                com: [{type: "INPUT",key: "btnName",viewAttr: 1}],
                colSpan: 1,
                width: '50%',
            }
        ];
        const checkboxColumn   = {
            title: getLabel('511881','是否启用'),
            dataIndex: "isUsed",
            com: [
               { type: 'CHECKBOX', key: 'isUsed'}
            ],
            showCheckAll: true,
            checkVauleType: [1, 0],
            colSpan: 1,
            width: '50%',
        }
        if(readonly) checkboxColumn.com[0].viewAttr=1; 
        columns.push(checkboxColumn);

        const cells= [//提交按钮的设置禁用
            {
              id: '0',
              isUsed: {
                com: [
                  {
                    type: "CHECKBOX",
                    key: "isUsed",
                    disabled: true
                  }
                ]
              }
            }
        ];

        return (
            <Dialog ecId={`${this && this.props && this.props.ecId || ''}_Dialog@yezfzj`}
                dialog={store}
                className="edc-combine-set-dialog"
            >
                <WeaTableEditable ecId={`${this && this.props && this.props.ecId || ''}_WeaTableEditable@09vusn`}
                    title={getLabel('511882','节点操作按钮设置')}
                    columns={columns}
                    datas={toJS(store.tableDatas)}
                    showTitle={false}
                    draggable={false}
                    getRowSelection={()=>null}
                    cells={cells}
                    onChange={store.setTableDatas}
                />
            </Dialog>
        )
    }

    


}